package com.origin.grid.framework.config;

import com.origin.grid.framework.modules.identity.IdentityInterception;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
@Slf4j
public class WebMvcConfig implements WebMvcConfigurer {

    @Resource
    private IdentityInterception interception;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        log.info("WebMvcConfig.addCorsMappings");
        registry.addInterceptor(interception)
                .addPathPatterns("/**");
    }
}
